#include "bloodtimer.h"

// Set up the timer
BloodTimer::BloodTimer(QObject *_parent, int tempID)
{
    connect(this, SIGNAL(timeout()), this, SLOT(inc()));
    this->setInterval(20);
    this->setObjectName(QString::number(tempID) + "bt");
    this->setParent(_parent);
    this->start();
}

// Delete the blood and the blood timer
void BloodTimer::inc()
{
    QMovie *tempTest = ((Person*)(this->object))->movie();
    if (tempTest->state() == 0) // check if complete then delete
    {
        ((HelicopterForm*)(this->parent()))->DeleteBloodAndTimer(this->object->objectName());
    }
}
